package com.online.mapper;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.online.entity.Teacher;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface TeacherMapper {
    /**
     * 查询所有的教师
     * @param teacherPage
     * @return
     */
    IPage<Teacher> findAll(Page teacherPage);

    /**
     * 根据Id查询教师
     * @param teacherId
     * @return
     */
   public Teacher findById(Integer teacherId);

    /**
     * 根据id删除教师
     * @param teacherId
     * @return
     */
   public int deleteById(Integer teacherId);

    /**
     * 修改教师个人信息
     * @param teacher
     * @return
     */
   public int update(Teacher teacher);

    /**
     * 添加教师
     * @param teacher
     * @return
     */
    @Options(useGeneratedKeys = true,keyProperty = "teacherId")
   public  int add(Teacher teacher);

    /**
     * 根据关键字搜索
     * @param page
     * @param keyword
     * @return
     */
    IPage<Teacher> findAllWithKeyword(Page<Teacher> page, @Param("keyword") String keyword);
}
